#include <QVBoxLayout>
#include <QHBoxLayout>
#include <QPushButton>

#include "src/core/generic/translator.h"
#include "src/gui/qt/loggerwarningdialog.h"

LoggerWarningDialog::LoggerWarningDialog(const Logger::container_type& container, QWidget *parent) :
    QDialog(parent)
{
  extern Translator translator;
  widget = new LoggerWidget;
  widget->setPriority(LoggerRecord::Norm);
  for (Logger::container_type::const_iterator i = container.begin(), e = container.end(); i !=e; ++i)
    widget->addRecord(*i);
  QPushButton *okButton = new QPushButton(translator.qString("OK", "button text"));
  okButton->setIcon(QIcon(":/actions/dialog-ok.png"));
  connect(okButton, SIGNAL(clicked()), this, SLOT(close()));
  QVBoxLayout *layout = new QVBoxLayout;
  layout->addWidget(widget);
  QHBoxLayout *horLayout = new QHBoxLayout;
  horLayout->addStretch();
  horLayout->addWidget(okButton);
  layout->addLayout(horLayout);
  setLayout(layout);
  resize(500,300);
}
